let mutations = {
    CHANGEINDEX(state, value) {
        state.index = value
    },
    changeDetail(state, payload) {
        state.detailData = payload
    },
    clearData(state) {
        state.detailData = ''
    },
    addCart(state, data) {
        state.cart.push(data);
    },
    addCartNum(state, {
        num,
        index
    }) {
        console.log(state.cart[index].num);
        state.cart[index].num += num
    },
    addShop(state, data) {
        console.log('123');
        state.shops.push(data)
    },
    addShopGoods(state, data) {
        state.shops[data.index].goods.push(data.detailData)
    },
    changeNum(state, data) {
        console.log(data.num);
        state.shops[data.index].goods[data.i].num += data.num
    },
    selectShop(state, data) {
        state.shops[data].flag = !state.shops[data].flag
    },
    selectGood(state, data) {
        state.shops[data.sindex].goods[data.gindex].flag = !state.shops[data.sindex].goods[data.gindex].flag
    },
    selectGoodA(state, data) {
        state.shops[data.index].goods[data.i].flag = data.flag
    },
    selectShopA(state, data) {
        state.shops[data.index].flag = data.flag
    },
    changeNumA(state, data) {
        console.log(data.num);
        state.shops[data.index].goods[data.i].num = data.num
    },
    deleteGoods(state, data) {
        console.log(data);
        state.shops[data.sindex].goods.splice(data.gindex, 1);
    },
    deleteShop(state, data) {
        state.shops.splice(data, 1);
    },
    setShop(state, data) {
        state.shops = data
    }
}
export default mutations